CREATE TABLE [dbo].[TTREPO_INBA]
(
[CO_EMPR] [dbo].[TD_VC_002] NOT NULL,
[NU_CNTB_EMPR] [dbo].[TD_IN_001_CONT] NOT NULL,
[CO_REPO_INBA] [dbo].[TD_VC_003] NOT NULL,
[CO_CNTA_EMPR] [dbo].[TD_VC_020_CNTA] NOT NULL,
[CO_USUA_CREA] [dbo].[TD_VC_008_USUA] NOT NULL,
[FE_USUA_CREA] [dbo].[TD_DT_001_SIST] NOT NULL CONSTRAINT [DF__TTREPO_IN__FE_US__0169315C] DEFAULT (getdate()),
[CO_USUA_MODI] [dbo].[TD_VC_008_USUA] NOT NULL,
[FE_USUA_MODI] [dbo].[TD_DT_001_SIST] NOT NULL CONSTRAINT [DF__TTREPO_IN__FE_US__025D5595] DEFAULT (getdate())
) ON [PRIMARY]
ALTER TABLE [dbo].[TTREPO_INBA] ADD
CONSTRAINT [FK1_TMPLAN_ANNO_A_TTREPO_INBA] FOREIGN KEY ([CO_EMPR], [CO_CNTA_EMPR]) REFERENCES [dbo].[TMPLAN_ANNO] ([CO_EMPR], [CO_CNTA_EMPR])
GO
ALTER TABLE [dbo].[TTREPO_INBA] ADD CONSTRAINT [CK__TTREPO_IN__CO_CN__00750D23] CHECK (([CO_CNTA_EMPR]>='0' AND [CO_CNTA_EMPR]<='99999999999999999999'))
GO
ALTER TABLE [dbo].[TTREPO_INBA] ADD CONSTRAINT [CK__TTREPO_IN__NU_CN__7F80E8EA] CHECK (([NU_CNTB_EMPR]>=(1) AND [NU_CNTB_EMPR]<=(99)))
GO
ALTER TABLE [dbo].[TTREPO_INBA] ADD CONSTRAINT [XPKTTREPO_INBA] PRIMARY KEY CLUSTERED  ([CO_EMPR], [NU_CNTB_EMPR], [CO_REPO_INBA], [CO_CNTA_EMPR]) ON [PRIMARY]
GO
ALTER TABLE [dbo].[TTREPO_INBA] ADD CONSTRAINT [TMPARA_CONT_A_TTREPO_INBA] FOREIGN KEY ([CO_EMPR]) REFERENCES [dbo].[TMPARA_CONT] ([CO_EMPR])
GO
